#pragma once
#include "Sort.h"

template <class T>
class BubbleSort : public Sort<T>
{
public:
	BubbleSort(void);
	~BubbleSort(void);

	bool MakeStepUpSort(MyArray<T> arr)
	{
		int size = arr.Count();

		if (size == 0)
			return false;

		for (int i = 0; i < size - 1; i++)
			for (int j = i + 1; j < size; j++)
			{
				if (arr[i] > arr[j])
					Swap(arr[i], arr[j]);
			}

		return true;
	};

	bool MakeStepDownSort(MyArray<T> arr)
	{
		int size = arr.Count();

		if (size == 0)
			return false;

		for (int i = 0; i < size - 1; i++)
			for (int j = i + 1; j < size; j++)
			{
				if (arr[i] < arr[j])
					Swap(arr[i], arr[j]);
			}

		return true;
	};
};

